<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="invGrupo" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{invGrupoHome.managed ? 'Editar' : 'Agragar'} Grupos </f:facet>

            <s:decorate id="gruCodigoField" template="layout/edit.xhtml">
                <ui:define name="label">Codigo grupo</ui:define>
                <h:inputText id="gruCodigo"
                       disabled="#{invGrupoHome.managed}"
                       required="true"
                       requiredMessage="Ingrese el codigo del grupo"
                           size="12"
                      maxlength="12"
                          value="#{invGrupoHome.instance.gruCodigo}">
                    <a:support event="onblur" reRender="gruCodigoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>
            <s:decorate id="gruNombreField" template="layout/edit.xhtml">
                <ui:define name="label">Nombre del grupo:</ui:define>
                <h:inputText id="gruNombre"
                       required="true"
                           size="50"
                      maxlength="50"
                      requiredMessage="Ingrese el nombre del grupo"
                          value="#{invGrupoHome.instance.gruNombre}">
                    <a:support event="onblur" reRender="gruNombreField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="gruDescripcionField" template="layout/edit.xhtml">
                <ui:define name="label">Descripcion</ui:define>
                <h:inputText id="gruDescripcion"
                           size="100"
                      maxlength="100"
                          value="#{invGrupoHome.instance.gruDescripcion}">
                    <a:support event="onblur" reRender="gruDescripcionField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="gruEstadoField" template="layout/edit.xhtml">
                <ui:define name="label">Estado:</ui:define>
                <h:selectBooleanCheckbox id="gruEstado"
                                   required="true"
                                      value="#{invGrupoHome.instance.gruEstado}"/>
            </s:decorate>




            <div style="clear:both">
                <span class="required">*</span>
                Campos requeridos
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Guardar"
                         action="#{invGrupoHome.persist}"
                       disabled="#{!invGrupoHome.wired}"
                       rendered="#{!invGrupoHome.managed}"/>

            <h:commandButton id="update"
                          value="Editar"
                         action="#{invGrupoHome.update}"
                       rendered="#{invGrupoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Eliminar"
                         action="#{invGrupoHome.remove}"
                      immediate="true"
                       rendered="#{invGrupoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancelar"
             propagation="end"
                    view="/InvGrupo.xhtml"
                rendered="#{invGrupoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancelar"
             propagation="end"
                    view="/#{empty invGrupoFrom ? 'InvGrupoList' : invGrupoFrom}.xhtml"
                rendered="#{!invGrupoHome.managed}"/>

        </div>
    </h:form>
</ui:define>

</ui:composition>
